package helpers

import (
	"fmt"
	"io/ioutil"
)

// GetCatalogueFile 获取指定目录文件 不读子目录
func GetCatalogueFile(path string) ([]string, error) {
	//获取文件或目录相关信息
	fileInfoList,err := ioutil.ReadDir(path)

	if err != nil{
		return nil,err
	}

	var fileNames = make([]string,len(fileInfoList))
	for i := range fileInfoList {
		fmt.Println(fileInfoList[i].Name()) //打印当前文件或目录下的文件或目录名
		fileNames[i] = fileInfoList[i].Name()
	}

	return fileNames,nil
}
